package action.connexion;

import service.securite.Erreur;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

public class DeconnexionAction extends Action {
    static final long serialVersionUID = 1L;
   
    public ActionForward execute(final ActionMapping pMapping,
			ActionForm pForm, final HttpServletRequest pRequete,
			final HttpServletResponse pReponse) {

    	HttpSession session = pRequete.getSession();
		if( session != null){ 
			session.invalidate();
		}
		
		return pMapping.findForward("success");
		//ServletContext context = getServletContext();
		//RequestDispatcher rd = context.getRequestDispatcher("/deconnexion.jsp");
		//rd.forward(request, response);
		
	}  

}